<template>
  <div class="content">
    <div class="datasa">
      <div class="biai">营业执照</div>
      <el-card class="box-card">
        <el-form ref="form" :model="formData" class="con-froms">
          <div style="display: flex">
            <el-form-item style="flex: 1" class="" label="">
              <el-row :gutter="110">
                <el-col :span="24">
                  <div class="avatar" v-if="formData.code_img">
                    <div
                      style="width: 100%; display: flex; justify-content: end"
                      class="xinimgs"
                    >
                      <i
                        class="el-icon-delete"
                        @click="yyImg()"
                        v-show="!detailShow"
                        style="z-index: 10"
                      ></i>
                    </div>
                    <el-image
                      style=""
                      :src="$baseUrl + formData.code_img"
                    ></el-image>
                  </div>
                  <el-upload
                    v-else
                    name="image"
                    class="avatar-uploader"
                    :action="baseImgUrl"
                    :show-file-list="false"
                    :on-success="yySuccess"
                    :before-upload="beforeAvatarUpload"
                  >
                    <div class="avatar-uploader-icon">
                      <i class="el-icon-plus"></i>
                      <!-- <span>公司章程</span> -->
                    </div>
                  </el-upload>
                </el-col>
              </el-row>
            </el-form-item>
          </div>
        </el-form>
      </el-card>
    </div>
    <div class="datasa">
      <div class="biai">
        公司信息
        <!-- <button @click="choose">点我选择区域</button>
  <div class="divwrap" v-if="show">
    <v-distpicker type="mobile" @province="onChangeProvince" @city="onChangeCity" @area="onChangeArea"></v-distpicker>
  </div> -->
      </div>

      <el-card class="box-card">
        <div style="display: flex; justify-content: end; padding: 5px">
          <!-- <el-button plain @click="dianjis">{{ dianjitxt }}</el-button> -->
          <!-- <el-button v-if="!gongsirz" plain disabled @click="gonganrz"
            >认证中</el-buttonv-else
          > -->
          <el-button  plain disabled>认证成功</el-button>
        </div>
        <el-form
          ref="form"
          :model="formData"
          label-width="150px"
          class="con-from"
        >
          <div style="display: flex">
            <el-form-item style="flex: 3" label="统一机构代码 :">
              <el-input disabled v-model="formData.unify_code"></el-input>
            </el-form-item>
            <!-- <el-form-item
              v-if="!csionasd"
              style="flex: 1"
              label=""
            >
            点击申请工商认证获取到公司信息然后展示在下面公司信息里
            </el-form-item> -->
            <!-- <el-button
              style="height: 40px; margin-left: 10px"
              v-if="formData.unify_code"
              plain
              @click="ResizeO"
              v-model="formData.meetingNum"
              >{{ gongshang }}</el-button >-->
          </div>
          <div  style="display: flex">
            <el-form-item style="flex: 1" label="企业名称 :">
              <el-input :disabled="dianji" v-model="shidata.company_name"></el-input>
            </el-form-item>
            <el-form-item style="flex: 1" label="法定代表人 :">
              <el-input :disabled="dianji" v-model="shidata.corporate_information"></el-input>
            </el-form-item>
          </div>
          <div   style="display: flex">
            <el-form-item style="flex: 1" label="法人手机号 :">
              <!-- :disabled="dianji" -->
              <el-input disabled v-model="shidata.corporate_phone"></el-input>
            </el-form-item>
            <el-form-item style="flex: 1" label="邮箱 :">
              <el-input :disabled="dianji" v-model="shidata.email"></el-input>
            </el-form-item>
          </div>

          <div   style="display: flex">
            <el-form-item style="flex: 1" label="组织机构代码 :">
              <el-input :disabled="dianji" v-model="shidata.organizationcode"></el-input>
            </el-form-item>
            <el-form-item style="flex: 1" label="工商注册号 :">
              <el-input :disabled="dianji" v-model="shidata.registrationnumber"></el-input>
            </el-form-item>
          </div>
          <div   style="display: flex">
            <el-form-item style="flex: 1" label="纳税人识别号 :">
              <el-input :disabled="dianji" v-model="shidata.nsr_no"></el-input>
            </el-form-item>
            <el-form-item style="flex: 1" label="企业类型 :">
              <el-input
                :disabled="dianji"
                v-model="shidata.enterprise_nature"
              ></el-input>
            </el-form-item>
          </div>
          <div   style="display: flex">
            <el-form-item style="flex: 1" label="营业期限 :">
                <el-input
                :disabled="dianji"
                v-model="shidata.businessterm"
              ></el-input>
            </el-form-item>
              <!-- yy_term_start  yy_term_end  -->
              <!-- <el-date-picker
                style="width: 100%"
                :disabled="dianji"
                v-model="value1"
                type="daterange"
                range-separator="至"
                :start-placeholder="shidata.businessterm"
                :end-placeholder="shidata.yy_term_end"
              >
              </el-date-picker> -->
              <!-- <el-input
                :disabled="dianji"
                v-model="shidata.comtype"
              ></el-input> -->
            </el-form-item>
            <el-form-item style="flex: 1" label="纳税人资质 :">
              <el-input
                :disabled="dianji"
                v-model="shidata.nsr_zizhi"
              ></el-input>
            </el-form-item>
          </div>
          <div   style="display: flex">
            <el-form-item style="flex: 1" label="人员规模 :">
              <el-input
                :disabled="dianji"
                v-model="shidatas.ren_number"
              ></el-input>
            </el-form-item>
            <el-form-item style="flex: 1" label="参保人数 :">
              <el-input
                :disabled="dianji"
                v-model="shidatas.cb_number"
              ></el-input>
            </el-form-item>
          </div>
          <div   style="display: flex">
            <el-form-item style="flex: 1" label="核准日期 :">
              <el-input :disabled="dianji" v-model="shidatas.hz_time"></el-input>
            </el-form-item>
            <el-form-item style="flex: 1" label="所属地区 :">
              <el-input :disabled="dianji" v-model="shidatas.diqu"></el-input>
            </el-form-item>
          </div>
          <div   style="display: flex">
            <el-form-item style="flex: 1" label="登记机关 :">
              <el-input
                :disabled="dianji"
                v-model="shidata.registrationauthority"
              ></el-input>
            </el-form-item>
            <el-form-item style="flex: 1" label="注册地址 :">
              <el-input :disabled="dianji" v-model="shidata.contact_address"></el-input>
            </el-form-item>
          </div>
          <div   style="display: flex">
            <el-form-item style="flex: 1" label="注册资本 :">
              <el-input :disabled="dianji" v-model="shidata.registeredcapital"></el-input>
            </el-form-item>
            <el-form-item style="flex: 1" label="成立时间 :">
              <!-- <el-input
             
              ></el-input> -->
              <el-date-picker
                class="shiji"
                :disabled="dianji"
                v-model="shidata.start_time"
                type="date"
                :placeholder="shidata.start_time"
              >
              </el-date-picker>
            </el-form-item>
          </div>
          <div   style="display: flex">
            <el-form-item style="flex: 1" label="营业范围 :">
              <el-input
                type="textarea"
                :disabled="dianji"
                v-model="shidata.scopeofbusiness"
              ></el-input>
            </el-form-item>
          </div>
          <div style="display: flex">
            <el-form-item style="width: 50%" label="登记状态 :">
              <el-input
                :disabled="dianji"
                v-model="shidata.dj_state"
              ></el-input>
            </el-form-item>
            <!-- <el-form-item style="flex: 1" label="企业详细地址 :">
              <el-input
                :disabled="dianji"
                v-model="formData.contact_address"
              ></el-input>
            </el-form-item> -->
          </div>
        </el-form>
      </el-card>
    </div>
    <div class="datasa">
      <div class="biai">对公账户</div>
      <el-card class="box-card">
        <el-form
          ref="form"
          :model="formData"
          label-width="150px"
          class="con-from"
        >
          <div style="display: flex">
            <el-form-item style="flex: 1" label="开户银行 :">
              <el-input disabled v-model="formData.account_bank"></el-input>
            </el-form-item>
            <el-form-item style="flex: 1" label="开户账号 :">
              <el-input disabled v-model="formData.basic_account"></el-input>
            </el-form-item>
          </div>
          <div style="display: flex">
            <el-form-item style="flex: 1" label="账号名称 :">
              <el-input disabled v-model="shidata.company_name"></el-input>
            </el-form-item>
            <el-form-item style="flex: 1" label="开户行地址 :">
              <el-input disabled v-model="formData.basic_ssaccount"></el-input>
            </el-form-item>
          </div>
          <div style="display: flex">
            <!-- <el-form-item style="flex: 1" label="账号名称 :">
              <el-input v-model="formData.account_name"></el-input>
            </el-form-item> -->
            <el-form-item style="width: 50%" label="开户行联行号 :">
              <el-input v-model="form.nassme"></el-input>
            </el-form-item>
            <!-- <el-form-item style="flex: 1" label="开户行地址 :">
              <el-input v-model="form.name"></el-input>
            </el-form-item> -->
          </div>
          <div style="display: flex">
            <el-form-item style="flex: 1" class="" label="开户许可证">
              <el-row :gutter="110">
                <el-col :span="24">
                  <div class="avatar" v-if="formData.openingpermit">
                    <div class="xinimg">
                      <i
                        class="el-icon-delete"
                        @click="khImg()"
                        v-show="!detailShow"
                        style="z-index: 10"
                      ></i>
                    </div>
                    <img
                      :src="$baseUrl + formData.openingpermit"
                      @click="zhengPreview()"
                    />
                    <!-- <i
                      class="el-icon-delete"
                      @click="khImg()"
                      v-show="!detailShow"
                      style="z-index: 10"
                    ></i> -->
                  </div>
                  <el-upload
                    v-else
                    name="image"
                    class="avatar-uploader"
                    :action="baseImgUrl"
                    :show-file-list="false"
                    :on-success="khSuccess"
                    :before-upload="beforeAvatarUpload"
                  >
                    <div class="avatar-uploader-icon">
                      <i class="el-icon-plus"></i>
                      <!-- <span>开户许可证</span> -->
                    </div>
                  </el-upload>
                </el-col>
              </el-row>
            </el-form-item>
          </div>
        </el-form>
      </el-card>
    </div>
    <div  class="datasa">
      <div class="biai">公司章程</div>
      <el-card class="box-card">
        <el-form ref="form" :model="formData" class="con-from">
          <div style="display: flex">
            <el-form-item style="flex: 1" class="" label="">
              <el-row :gutter="110">
                <el-col :span="24">
                  <div class="avatar" v-if="formData.constitution">
                    <div
                      style="width: 100%; display: flex; justify-content: end"
                    >
                      <i
                        class="el-icon-delete"
                        @click="zcImg()"
                        v-show="!detailShow"
                        style="z-index: 10"
                      ></i>
                    </div>
                    <div style="width: 80%" class="xinimgs">
                      <div style="display: flex; align-items: center">
                        <div>
                          <img
                            style="height: 80px"
                            src="@/assets/BidSecurity/EP_PDF.png"
                            alt=""
                          />
                        </div>
                        <div style="font-size: 16px">
                          <div>文件地址：</div>
                          <div>
                            {{ formData.constitution }}
                          </div>
                        </div>
                      </div>
                      <div style="">
                        <el-button @click="yulan()" plain>预览</el-button>
                        <el-button plain>查看模板</el-button>
                      </div>
                    </div>
                  </div>
                  <el-upload
                    v-else
                    name="image"
                    class="avatar-uploader"
                    :action="baseImgUrl"
                    :show-file-list="false"
                    :on-success="zcSuccess"
                    :before-upload="beforeAvatarUpload"
                  >
                    <div class="avatar-uploader-icon">
                      <i class="el-icon-plus"></i>
                    </div>
                  </el-upload>
                </el-col>
              </el-row>
            </el-form-item>
          </div>
        </el-form>
      </el-card>
    </div>
    <div class="datasa">
      <div class="biai">法人资料</div>
      <el-card class="box-card">
        <el-form
          ref="form"
          :model="formData"
          label-width="150px"
          class="con-from"
        >
          <div style="display: flex">
            <!-- <el-form-item style="flex: 1" label="法人名称 :">
              <el-input v-model="formData.username"></el-input>
            </el-form-item> -->
            <!-- <el-form-item style="flex: 1" label="法人手机号 :">
              <el-input v-model="formData.mobile"></el-input>
            </el-form-item> -->
          </div>
          <div style="display: flex">
            <el-form-item style="width: 50%" label="法人身份证 :">
              <el-input disabled v-model="formData.usercode"></el-input>
            </el-form-item>
            <!-- <el-form-item style="flex: 1" label="法人手机号 :">
              <el-input v-model="formData.mobile"></el-input>
            </el-form-item> -->
          </div>
          <el-form-item class="" label="身份证正面">
            <el-row :gutter="110">
              <el-col :span="24">
                <div class="avatar" v-if="formData.id_card_front">
                  <div class="xinimg">
                    <i
                      class="el-icon-delete"
                      @click="sfzzImg()"
                      v-show="!detailShow"
                      style="z-index: 10"
                    ></i>
                  </div>
                  <img
                    :src="$baseUrl + formData.id_card_front"
                    @click="zhengPreview()"
                  />
                  <!-- <i
                    class="el-icon-delete"
                    @click="sfzzImg()"
                    v-show="!detailShow"
                    style="z-index: 10"
                  ></i> -->
                </div>
                <el-upload
                  v-else
                  name="image"
                  class="avatar-uploader"
                  :action="baseImgUrl"
                  :show-file-list="false"
                  :on-success="sfzzSuccess"
                  :before-upload="beforeAvatarUpload"
                >
                  <div class="avatar-uploader-icon">
                    <i class="el-icon-plus"></i>
                    <span>请上传横向照片</span>
                  </div>
                </el-upload>
              </el-col>
            </el-row>
          </el-form-item>
          <el-form-item class="" label="身份证反面">
            <el-row :gutter="110">
              <el-col :span="24">
                <div class="avatar" v-if="formData.id_card_reverse">
                  <div class="xinimg">
                    <i
                      class="el-icon-delete"
                      @click="sfzfImg()"
                      v-show="!detailShow"
                      style="z-index: 10"
                    ></i>
                  </div>
                  <img
                    :src="$baseUrl + formData.id_card_reverse"
                    @click="fanPreview()"
                  />
                  <!-- <i
                    class="el-icon-delete"
                    @click="sfzfImg()"
                    v-show="!detailShow"
                  ></i> -->
                </div>
                <el-upload
                  v-else
                  name="image"
                  class="avatar-uploader"
                  :action="baseImgUrl"
                  :show-file-list="false"
                  :on-success="sfzfSuccess"
                  :before-upload="beforeAvatarUpload"
                >
                  <div class="avatar-uploader-icon">
                    <i class="el-icon-plus"></i>
                    <span>请上传横向照片</span>
                  </div>
                </el-upload>
              </el-col>
            </el-row>
          </el-form-item>
        </el-form>
      </el-card>
    </div>

    <div class="datasa">
      <div class="biai">企业公章</div>
      <el-card class="box-card">
        <el-form ref="form" :model="formData" class="con-froms">
          <div style="display: flex">
            <el-form-item style="flex: 1" class="" label="">
              <el-row :gutter="110">
                <el-col :span="24">
                  <div class="avatar" v-if="formData.qygUrl">
                    <div class="xinimg">
                      <el-button
                        icon="el-icon-delete"
                        @click="qygImg()"
                        plain
                        v-show="qygz !== '认证成功'"
                      ></el-button>
                      <el-button plain @click="qyrenzheng">{{
                        qygz
                      }}</el-button>
                      <!-- <i
                        class="el-icon-delete"
                        @click="frsImg()"
                        v-show="!detailShow"
                        style="z-index: 10"
                      ></i> -->
                    </div>
                    <div
                      style="
                        width: 100%;
                        justify-content: flex-end;
                        display: flex;
                        font-size: 16px;
                      "
                    >
                      编号：{{ qygzid }}
                    </div>
                    <div style="width: 80%; display: flex">
                      <img
                        :src="$baseUrl + formData.qygUrl"
                        @click="zhengPreview()"
                      />
                    </div>
                  </div>
                  <el-upload
                    v-else
                    name="image"
                    class="avatar-uploader"
                    :action="baseImgUrl"
                    :show-file-list="false"
                    :on-success="qygSuccess"
                    :before-upload="beforeAvatarUpload"
                  >
                    <div class="avatar-uploader-icon">
                      <i class="el-icon-plus"></i>
                      <!-- <span>企业公章</span> -->
                    </div>
                  </el-upload>
                </el-col>
              </el-row>
            </el-form-item>
          </div>
        </el-form>
      </el-card>
    </div>
    <div  class="datasa">
      <div class="biai">法人章</div>
      <el-card class="box-card">
        <el-form ref="form" :model="formData" class="con-froms">
          <div style="display: flex">
            <el-form-item style="flex: 1" class="" label="">
              <el-row :gutter="110">
                <el-col :span="24">
                  <div class="avatar" v-if="formData.frzUrl">
                    <div class="xinimg">
                      <el-button
                        v-if="frzz !== '认证成功'"
                        icon="el-icon-delete"
                        @click="frzImg()"
                        plain
                      ></el-button>
                      <el-button plain @click="frrenzheng">{{
                        frzz
                      }}</el-button>
                    </div>
                    <div
                      style="
                        width: 100%;
                        justify-content: flex-end;
                        display: flex;
                        font-size: 16px;
                      "
                    >
                      编号：{{ frzzid }}
                    </div>
                    <div style="width: 80%; display: flex">
                      <img
                        :src="$baseUrl + formData.frzUrl"
                        @click="zhengPreview()"
                      />
                    </div>
                  </div>
                  <el-upload
                    v-else
                    name="image"
                    class="avatar-uploader"
                    :action="baseImgUrl"
                    :show-file-list="false"
                    :on-success="frzSuccess"
                    :before-upload="beforeAvatarUpload"
                  >
                    <div class="avatar-uploader-icon">
                      <i class="el-icon-plus"></i>
                      <!-- <span>法人章</span> -->
                    </div>
                  </el-upload>
                </el-col>
              </el-row>
            </el-form-item>
          </div>
        </el-form>
      </el-card>
    </div>
    <div v-if="0" class="datasa">
      <div class="biai">资质证书</div>
      <el-card class="box-c"> </el-card>
    </div>
    <!-- 头像未完结 -->

    <div
      style="padding: 20px; display: flex; justify-content: center"
      class="footer"
      v-if="false"
    >
      <el-button
        type=""
        style="
          width: 187px;
          font-size: 18px;
          padding: 15px;
          background-color: #5093eb;
        "
        class="btn"
        v-if="shenhe"
        @click="buchong"
        >{{ erci }}</el-button
      >
      <el-button
        type=""
        style="
          width: 187px;
          font-size: 18px;
          padding: 15px;
          background-color: #5093eb;
        "
        class="btn"
        v-if="shenhe"
        @click="xiayibu"
        >下一步</el-button
      >
      <!-- <el-button
        type="info"
        v-else
        style="width: 187px; font-size: 18px; padding: 15px;    background-color: #5093eb;
"
        @click="getrenzhengs"
        >{{ cisson }}</el-button
      > -->

      <el-button
        type=""
        style="width: 187px; font-size: 18px; padding: 15px"
        class="btn"
        v-if="chtijiao"
        @click="chongxin"
        >重新提交</el-button
      >
      <!-- @click="companyadds" -->
      <!-- <el-button type="" class="btn" @click="cancel">取消</el-button> -->
    </div>
  </div>
</template>
<script>
import {
  companyadd,
  companyseal,
  zhizhao,
  companyinfo,
  idcard,
} from "@/api/personal";
import { faren, companystatus, companyziliao } from "@/api/system/liucheng";
import { getrenzheng, frzrenzheng, gzrenzheng,getinfo } from "@/api/user";
export default {
  data() {
    return {
      labelPosition: "right",
      labelPosition1: "right",
      gongshang: "申请工商认证",
      password_again: null,
      // 表单认证
      dianji: true,
      dianjitxt: "编辑",
      zizhilist: [],
      grzx: [],
      outlist: [],
      show: false,
      modifylist: {
        password: "",
        old_password: "",
        id: "",
        user_id: "",
      },
      formData: {
        shijina: "",
        yingyefanwei: "",
        frzUrl: "",
        qygUrl: "",
        company_name: "", //中豫担保（测试）公司名称
        comtype: "", //私营企业性质
        unify_code: "", //91411328MA9F1AA70J社会统一代码
        contact_address: "郑州管城区航海路", //详细地址
        code_img: "", ///uploads/image/20221113/6370979bce4af.jpeg企业营业执照照片
        username: "", //王治家法人姓名
        mobile: null, //13681030210法人手机号
        usercode: null, //410323197410258735法人身份证号
        id_card_front: "", ///uploads/image/20221113/6370b5050e1ba.jpg法人身份证正面
        id_card_reverse: "", ///uploads/image/20221113/6370b4e48100f.jpg法人身份证反面
        account_bank: "", //郑州银行开户行
        basic_account: null, //34859384223基本账号
        account_name: "", //中豫公司账号名称
        legalAuthorization: "", ///uploads/image/20221113/637097e85911e.jpeg法人授权书
        province: "河南省", //省
        city: "郑州市", //市
        area: "管城区", //区
        constitution: "", ///uploads/image/20221113/637097f559c0f.jpeg公司章程
        audit: "", ///uploads/image/20221113/637097c183cee.jpeg近一年审计报告
        openingpermit: "", ///uploads/image/20221113/637097d894853.jpeg开户许可证
      },
      shidata: {
        area: "",
        bank_name: "",
        bank_number: null,
        cb_number: "",
        dj_jiguan: "",
        dj_state: "",
        e_name: "",
        email: "",
        faren: "",
        hangye: "",
        hz_time: null,
        id: null,
        is_guogi: null,
        is_shangshi: null,
        ig_code: "",
        jianjie: "",
        jk_code: "",
        jy_fanwei: "",
        mobile: "",
        name: "",
        nb_addr: "",
        nsr_no: "",
        nsr_zizhi: "",
        qcc_id: "",
        qy_state: "",
        ren_number: "",
        sj_ziben: "",
        start_time: "",
        ty_code: "",
        web: "",
        yy_term_end: "g",
        yy_term_start: "",
        zc_addr: "",
        zc_no: "",
        zc_ziben: "",
      },
      gcxian: true,
      frxian: true,
      gzxian: true,
      fzxian: true,
      form: {},
      title: "",
      open1: false,
      yeji_search: "",
      cisson: "刷新认证状态",
      geren: {},
      corporatelist: [],
      seallist: [],
      yejilist: [],
      tabPosition: "left",
      search: "",
      baseImgUrl: "http://192.168.0.28:8082/apply/gong/uploads",
      // formData: {},
      yeji_params: {
        limit: 10,
        offset: 0,
        keywords: "",
        user_id: sessionStorage.getItem("id"),
      },
      wenjian: "",
      yeji_total: null,
      activeName: "first",
      tableData: "",
      smShow: false,
      csionasd: true,
      value1: "",
      farenshe: false,
      dialogVisible: false,
      gongsirz: false,
      gongsirzs: true,
      chtijiao: false,
      xinde: {},
      erci: "提交信息",
      qygz: "认证",
      frzz: "认证",
      shenhe: true,
      detailShow: true,
      shidatas:{
diqu:"暂无",
ren_number:"暂无",
cb_number:"暂无",
hz_time:"暂无",
    },
    };
    
  },
  watch: {
    formData: {
      handler(newName, oldName) {
        // console.log("shuju发生改变",newName)
        var cion = JSON.stringify(newName);
        // console.log("刷新存储数据",cion)
        sessionStorage.setItem("renzhengxinxi", cion);
      },
      immediate: true,
      deep: true,
    },
  },
  mounted() {},
  created() {
    // console.log("huoqudao的信息",JSON.parse(sessionStorage.getItem("renzhengxinxi")))
    this.getrenzhengs(); //查询企业认证
    //  this.gongsirz = true;
  },
  methods: {
    chongxin() {
      this.$router.push({ path: "/RealName/PersonalRealname" });
    },
    frzrenzhengs() {
      var bbc = { unify_code: this.formData.unify_code };
      // debugger
      frzrenzheng(bbc).then((res) => {
        if (res.data.code == 1) {
          this.formData.frzUrl = res.data.data.file;
          if (res.data.data.state == 1) {
            this.frzz = "认证成功";
            this.frzzid = res.data.data.code;
          }
        } else {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "error",
          });
        }
        console.log("法人章认证");
      });
      // frzrenzhen(bbc).then((response) => {
      //   console.log("法人章认证", response.data);
      //   if (response.data.code == 1) {
      //     this.$message({
      //       showClose: true,
      //       message: response.data.msg,
      //       type: "success",
      //     });
      //     this.erci="刷新认证状态"
      //   } else {
      //     this.$message({
      //       showClose: true,
      //       message: response.data.msg,
      //       type: "error",
      //     });
      //   }
      // });
    },
    gzrenzhengs() {
      // return
      var bbc = { unify_code: this.formData.unify_code };
      gzrenzheng(bbc).then((response) => {
        if (response.data.code == 1) {
          this.formData.qygUrl = response.data.data.file;
          if (response.data.data.state == 1) {
            this.qygz = "认证成功";
            this.qygzid = response.data.data.code;
          }
          //  console.log("公司章认证", res.data.data);
          // this.$message({
          //   showClose: true,
          //   message: response.data.msg,
          //   type: "success",
          // });
          // this.erci="刷新认证状态"
        } else {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "error",
          });
        }
      });
    },
    xiayibu() {
      if (this.formData.openingpermit !== "") {
        this.gcxian = true;
        console.log(8);
      } else {
        this.$message({
          showClose: true,
          message: "请填写对公账户信息",
          type: "warning",
        });
      }
      if (this.formData.constitution !== "") {
        this.frxian = true;
        console.log(1);
      }
      if (this.formData.id_card_reverse !== "") {
        this.gzxian = true;
        console.log(2);
      }
      if (this.formData.qygUrl !== "") {
        this.fzxian = true;
        this.shenhe = true;
        console.log(3);
      }
    },
    getrenzhengs() {
      console.log("unify_code",sessionStorage.getItem("unify_code"))
      // return
      this.formData.unify_code = sessionStorage.getItem("unify_code");
      var bbc = { unify_code: sessionStorage.getItem("unify_code")};
      getinfo(bbc).then((res) => {
        if (res.data.code == 1) {
          // debugger
          // console.log("hasgdjfgjsgdfjgjasgdfhgsagdfhsd",res.data.data.status == 2 && res.data.data.comstate == 2)
 this.frzrenzhengs();
 
            this.gzrenzhengs();
          // this.ResizeO();
          // res.data.data.comstate
          this.xinde = res.data.data;
          this.shidata = res.data.data.detail;
          if(res.data.data.plus!==null){
               this.shidatas = res.data.data.plus;
          }
        
           console.log(res.data.data)
          this.formData.mobile = res.data.data.detail.corporate_phone;
          this.formData.code_img = res.data.data.detail.business_license_pic;
          (this.formData.id_card_front = this.xinde.detail.id_card_front), //法人身份证正面
            (this.formData.id_card_reverse = this.xinde.detail.id_card_reverse); //法人身份证反面

          this.formData.account_bank = this.xinde.detail.account_bank; //开户行
          this.formData.constitution = this.xinde.detail.constitution; //公司章程
          this.formData.basic_account = this.xinde.detail.basic_account; //基本账号
          this.formData.openingpermit = this.xinde.detail.openingpermit; //开户许可证
          this.formData.usercode = this.xinde.detail.corporate_id_number;
          var con = res.data.data.comstate;
          if (res.data.data.status == 2 && res.data.data.comstate == 2) {
            this.erci = "认证通过";
            this.gongsirz = true;
           
            return;
          }
          if (con == 1) {
            //  this.erci = "刷新认证状态";
            //  this.$router.push({path:'/RealName/PersonalRealnames'})
            return;
          }
          if (con == 2) {
            // this.$router.push({
            //               path:'/'
            //           })
            this.shenhe = false;
            this.erci = "提交认证";
            this.gongsirzs = false;
            this.gongsirz = true;
            // this.frzrenzhengs();
            // console.log("diaoyondiaoyoasdhasdhkjahsdkhakhsdkhaksdhkjahsdkkashdkjahsdkhaksd")
            // this.gzrenzhengs();
            return;
          }
          if (con == 3) {
            this.cisson = "审核失败";
            this.chtijiao = true;
          } else {
            // this.$router.push({
            //   path: "/",
            // });
          }
          //   this.$message({
          //     showClose: true,
          //     message: res.data.msg,
          //     type: "success",
          //   });
        } else {
          this.$message({
            showClose: true,
            message: res.data.msg,
            type: "error",
          });
        }
        // sessionStorage.setItem('token',res.data.data.token)
        // sessionStorage.setItem('user_id',res.data.data.id)
        // this.$router.push({
        //     path:'/'
        // })
      });
    },
    companyst() {
      this.formData.unify_code = sessionStorage.getItem("unify_code");
      var bbc = {
        companyName: sessionStorage.getItem("company_name"),
      };
      companystatus(bbc).then((response) => {
        console.log(response);
        if (response.data.code == 1) {
          // this.$message({
          //   showClose: true,
          //   message: response.data.msg,
          //   type: "success",
          // });
          // this.gongsirz=true  //审核通过 可以填写信息
          //查询企业信息
          if (response.data.msg.code == 0) {
          }
        } else {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "error",
          });
        }
      });
    },
    buchong() {
      if (this.erci == "刷新认证状态") {
        this.getrenzhengs();
        return;
      }
      if (this.erci == "认证通过") {
        this.$router.push({
          path: "/",
        });
        return;
      }
      companyziliao(this.formData).then((response) => {
        console.log(response);
        if (response.data.code == 1) {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "success",
          });
          this.erci = "刷新认证状态";
        } else {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "error",
          });
        }
      });
    },
    choose() {
      this.show = !this.show;
    },
    onChangeProvince(a) {
      console.log(a);
    },
    onChangeCity(a) {
      console.log(a);
    },
    onChangeArea(a) {
      console.log(a);
      this.show = false;
    },
    frrenzheng() {
      if (this.frzz == "认证成功") {
        return;
      }
      var bbc = {
        unify_code: this.formData.unify_code,
        imgsign: this.formData.frzUrl,
        type: 1,
      };
      companyseal(bbc).then((response) => {
        console.log(response);
        if (response.data.code == 1) {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "success",
          });
          this.frzrenzhengs();
        } else {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "error",
          });
        }
      });
    },
    qyrenzheng() {
      if (this.qygz == "认证成功") {
        return;
      }
      var bbc = {
        unify_code: this.formData.unify_code,
        imgsign: this.formData.qygUrl,
        type: 2,
      };
      companyseal(bbc).then((response) => {
        console.log(response);
        if (response.data.code == 1) {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "success",
          });
          this.gzrenzhengs();
        } else {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "error",
          });
        }
      });
    },
    companyadds() {
      // var bbc = {
      //   unify_code: this.formData.unify_code,
      //   imgsign: this.formData.qygUrl,
      //   type: 2,
      // };
      companyadd(this.formData).then((response) => {
        console.log(response);
      });
    },
    csionasds() {
      this.csionasd = !this.csionasd;
    },
    dianjis() {
      console.log("datin打印状态", this.dianjitxt == "编辑");
      if (this.dianjitxt == "编辑") {
        console.log("编辑打印状态");
        this.dianji = false;
        this.dianjitxt = "完成";
      } else {
        console.log("完成打印状态");
        this.dianji = true;
        this.dianjitxt = "编辑";
      }
    },
    gonganrz() {
      this.dialogVisible = true;
      // companyadd(this.formData).then((response) => {
      //       console.log(response);
      //     });
    },
    renzhengaisd() {
      companyadd(this.formData).then((response) => {
        console.log(response);
        if (response.data.code == 1) {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "success",
          });
          this.dialogVisible = false;
        } else {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "error",
          });
        }
      });
    },
    // 实名认证
    shiming() {
      this.smShow = true;
    },

    // //公司认证信息
    // gongsirenzheng() {
    //   gongsirenzheng().then((response) => {
    //     this.formData = response.data.info;
    //   });
    // },
    //企业营业执照照片
    yySuccess(res, file) {
      console.log("上传", res);
      this.formData.code_img = res.data;
      this.zhizhaotyoe(res.data);
    },
    beforeAvatarUpload() {},
    ResizeO() {
      if (this.gongshang == "认证成功") {
        return;
        this.$message({
          showClose: true,
          message: "已经认证成功",
          type: "success",
        });
      }
      const loading = this.$loading({
        lock: true,
        text: "查询中",
        customClass: "jiazaiimg",

        background: "rgba(0, 0, 0, 0.7)",
      });
      companyinfo({ unifycode: this.formData.unify_code }).then((response) => {
        console.log("chacun", response);
        if (response.data.code == 1) {
          // this.$message({
          //   showClose: true,
          //   message: "认证成功",
          //   type: "success",
          // });
          this.gongshang = "认证成功";
          this.shidata = response.data.data;
          this.shidata.start_time = this.dateFormats(this.shidata.start_time);
          this.shidata.yy_term_start = this.dateFormats(
            this.shidata.yy_term_start
          );
          this.shidata.hz_time = this.dateFormats(this.shidata.hz_time);
          if (this.shidata.yy_term_end == 0) {
            this.shidata.yy_term_end = "无固定期限";
          } else {
            this.shidata.yy_term_end = this.dateFormats(
              this.shidata.yy_term_end
            );
          }
          this.shidata.name = this.xinde.detail.company_name; //公司名称
          this.shidata.qy_state = this.xinde.detail.enterprise_nature; //企业性质
          this.shidata.zc_addr = this.xinde.detail.contact_address; //详细地址
          this.shidata.faren = this.xinde.detail.corporate_information;
          this.formData.mobile = this.shidata.mobile;
          this.formData.account_name = this.shidata.name; //账号名称
          this.shidata.zhuce = this.xinde.detail.registeredcapital;
          // this.xinde.subscribedcapital = this.shidata.sj_ziben;
          // this.xinde.foundingtime = this.shidata.start_time;
          // this.xinde.scopeofbusiness = this.shidata.jy_fanwei;
          // this.xinde.taxtype = "";
          // this.xinde.registrationauthority = this.shidata.dj_jiguan;
          // this.xinde.registrationnumber = this.shidata.zc_no;
          // this.xinde.foundingtime = this.shidata.start_time;
          // this.xinde.businessterm =
          //   this.shidata.hz_time + " 至 " + this.shidata.yy_term_end;

          // this.formData.taxtype = this.shidata.mobile;
          this.csionasd = true;
        } else {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "error",
          });
        }
        loading.close();
      });
    },
    zhizhaotyoe(res) {
      const loading = this.$loading({
        lock: true,
        text: "识别中",
        customClass: "jiazaiimg",
        // spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      // setTimeout(() => {

      // }, 6000);
      zhizhao({ file: res }).then((response) => {
        if (response.data.code == 200) {
          console.log("营业执照", response.data.code, response.data.data);
          this.formData.unify_code = response.data.data.unified_identifier;
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "success",
          });
        } else {
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "error",
          });
        }
        loading.close();
      });
    },
    yyImg() {
      this.formData.code_img = "";
    },
    //公司章程
    zcSuccess(res, file) {
      console.log("上传", res);
      this.formData.constitution = res.data;
    },
    zcImg() {
      this.formData.constitution = "";
    },
    //开户许可证
    khSuccess(res, file) {
      console.log("上传", res);
      this.formData.openingpermit = res.data;
    },
    khImg() {
      this.formData.openingpermit = "";
    },
    //近一年审计报告
    sjSuccess(res, file) {
      console.log("上传", res);
      this.formData.audit = res.data;
    },
    sjImg() {
      this.formData.audit = "";
    },
    //法人授权书
    frsSuccess(res, file) {
      var bbc = res.data;
      this.wenjian = bbc.split(".")[1];

      console.log("上传", res, this.wenjian);
      this.formData.legalAuthorization = res.data;
    },
    frsImg() {
      this.formData.legalAuthorization = "";
    },
    //法人身份证正面
    sfzzSuccess(res, file) {
      console.log("上传", res);

      this.renx(res.data);
    },
    renx(e) {
      idcard({ file: e }).then((response) => {
        console.log("shenfenz", response);
        if (response.data.code == 200) {
          this.formData.usercode = response.data.data.id_number;
          this.formData.id_card_front = e;
          this.farenshe = true;
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "success",
          });
        } else {
          this.formData.id_card_front = "";
          this.$message({
            showClose: true,
            message: response.data.msg,
            type: "error",
          });
        }
      });
    },
    sfzzImg() {
      this.formData.id_card_front = "";
    },
    //法人身份证反面
    sfzfSuccess(res, file) {
      console.log("上传", res);
      this.formData.id_card_reverse = res.data;
    },
    sfzfImg() {
      this.formData.id_card_reverse = "";
    },
    qygSuccess(res, file) {
      console.log("上传", res);
      this.formData.qygUrl = res.data;
    },
    qygImg() {
      this.formData.qygUrl = "";
    },
    frzSuccess(res, file) {
      console.log("上传", res);
      this.formData.frzUrl = res.data;
    },
    frzImg() {
      this.formData.frzUrl = "";
    },
    yulan() {
           this.$confirmMy({
        title: this.formData.constitution,
       
      })
      return
      var url = this.$baseUrl 
      let link = document.createElement("a");
      link.style.display = "none";
      link.style.download = "";
      link.target = "_blank";
      link.href = url;
      // console.log(link.href)
      // link.setAttribute("download", ".pdf");
      // +'.pdf' 通过不同的后缀名下载不同的文件
      //这里下载的是pdf格式的文件，拿到接口里的res也必须是pdf的文件流
      // document.body.appendChild(link);
      link.click();
      URL.revokeObjectURL(link.href);
    },
    // yyrUpload(file) {
    //   console.log("图片")
    // },
    details(rows) {
      this.open1 = true;
      this.formData = rows;
    },
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
    dateFormats(value) {
      let date = new Date(value * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
      let y = date.getFullYear();
      let MM = date.getMonth() + 1;
      MM = MM < 10 ? "0" + MM : MM;
      let d = date.getDate();
      d = d < 10 ? "0" + d : d;
      let h = date.getHours();
      h = h < 10 ? "0" + h : h;
      let m = date.getMinutes();
      m = m < 10 ? "0" + m : m;
      let s = date.getSeconds();
      s = s < 10 ? "0" + s : s;
      return y + "-" + MM + "-" + d; //多种时间格式的拼接
    },
  },
};
</script>
<style scoped>
.jiazaiimg {
  font-size: 50px !important;
  /* width: 100%; */
}
.jiazaiimg .el-loading-text {
  font-size: 16px !important;
}
.shiji {
  width: 100% !important;
}
.el-form-item {
  margin-bottom: 10px !important;
}
.box-card .el-card__body {
  padding: 0px !important;
}
.xindes .el-table__body-wrapper {
  height: 36vh;
  overflow: auto;
  position: relative;
}
</style>
<style scoped lang="scss">
.xinimg {
  width: 100%;
  justify-content: end;
  display: flex;
}
.datasa {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.box-card {
  width: 75%;
  padding: 0 !important;
}
.box-c {
  width: 75%;
  // padding: 0 !important;
}
.con-from {
  padding: 20px;
  padding-right: 87px;
}
.con-froms {
  padding: 20px;
  // padding-right: 87px;
}
.biai {
  background: #dddddd;
  width: 100%;
  padding: 10px;
  font-size: 20px;
  margin-bottom: 20px;
}
.content {
  height: 82vh;
  // background-color: #fff;
}

ul,
li {
  list-style: none;
}
.btn {
  // padding: 20px;
  color: #fff;
  background-color: #409eff;
  border-color: #409eff;
}
.header {
  position: relative;
  display: flex;
  justify-content: space-around;
  width: 100%;
  height: 60px;
  line-height: 60px;
  margin-bottom: 10px;
}

.header .header-left {
  position: absolute;
  left: 20px;
  top: -20px;
}

.header .header-right {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

.header .header-right .img1 {
  position: absolute;
  right: 130px;
  top: 15px;
  width: 20px;
  text-align: center;
  height: 20px;
}

.header .header-right .img2 {
  position: absolute;
  right: 70px;
  top: 13px;
  width: 20px;
  height: 20px;
  border: none;
}

.header .header-right .img2 .img3 {
  position: absolute;
  left: 10px;
  bottom: 2px;
  width: 20px;
  height: 20px;
}

.personal_box {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;

  .box_personal_content {
    width: 100%;
  }

  .el-form-item {
    margin-bottom: 10px !important;
  }
}
.personal_box1 {
  width: 60%;
  display: flex;
  justify-content: center;
  margin: 0 auto;
}
.Personal {
  width: 40%;
}

::v-deep .el-form--label-top .el-form-item__label {
  padding: 0 !important;
}

::v-deep .Personal .el-input__inner {
  width: 100%;
  // border: 0;
  // border: #ccc 1px solid;
  border-radius: 0;
  padding: 0 0 0 10px;
}

::v-deep.el-input.is-disabled .el-input__inner {
  // background-color: #fff;
  color: #000000;
}
.xinimgs {
  display: flex;
  justify-content: space-between;
}
// 搜索框
.search {
  float: right;
  width: 15%;
  height: 40px;
  border: 1px solid #ccc;
  border-radius: 5px;
  display: flex;

  ::v-deep .el-input__inner {
    border: none;
  }

  ::v-deep .el-button {
    border: none;
  }
}

.update_password {
  width: 100%;
  display: flex;
  justify-content: center;

  .update {
    width: 30%;
  }

  .el-form-item {
    margin-bottom: 10px !important;
  }
}

::v-deep.el-form--inline .el-form-item {
  width: 100%;
}

::v-deep.el-form--inline .el-form-item__content {
  width: 100%;
}

.block {
  position: fixed;
  bottom: 20px;
  right: 20px;
}

.password li:nth-of-type(4) button {
  background-color: #1795ff;
  width: 200px;
  height: 40px;
  border: none;
}

.el-tabs--left {
  height: 100%;
}

::v-deep.el-tabs--left .el-tabs__item.is-left {
  width: 200px;
  height: 50px;
  line-height: 50px;
  text-align: center;
  font-size: 16px;
  font-family: MicrosoftYaHei-, MicrosoftYaHei;
  font-weight: normal;
  color: #000000;
}

::v-deep.el-tabs--left .el-tabs__item.is-active {
  background: #1795ff;
  color: #fff;
}

.formUser {
  margin-top: 100px;
}

.card_father {
  height: 64vh;
  margin-top: 10px;
  overflow: auto;

  .card {
    width: 44%;
    height: 200px;
    background: #ffffff;
    box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.16);
    border-radius: 8px 8px 8px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 1;
    margin: 20px;

    .card_content {
      width: 100%;
      height: 100%;
      padding: 10px;
    }

    .caakuia {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .kuaidcaa {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
  }
}
.el-icon-delete {
  display: block;
}
::v-deep .tab_left > .el-tabs__header {
  height: 82vh !important;
  background-color: #fff;
}

::v-deep .tab_left > .el-tabs__content {
  height: 100%;
  overflow-y: auto;
}

// ::v-deep .el-tabs__nav-wrap::after {
//   content: "";
//   position: absolute;
//   left: 0;
//   bottom: 0;
//   width: 100%;
//   height: 2px;
//   background-color: #ffff !important;
//   z-index: 99;
// }

.imgBox {
  display: flex;
  flex-direction: column;
  width: 100%;
  // height: 120px;
  margin-bottom: 10px;

  img {
    width: 100%;
    height: 140px;

    // border: 1px solid;
    margin-bottom: 10px;
  }
}
.avatar-uploader {
  display: flex;
  justify-content: center;
}
// 新增弹窗上传图片
.avatar-uploader .el-upload {
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader-icon {
  background: rgba(0, 0, 0, 0.02);
  border-radius: 4px 4px 4px 4px;
  border: 1px dashed rgba(0, 0, 0, 0.15);
  font-size: 14px;
  color: #8c939d;
  width: 300px;
  height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  .el-icon-plus {
    font-size: 28px;
  }
}

.avatar {
  // width: 200px;
  // height: 138px;
  display: flex;
  align-items: center;
  font-size: 20px;
  flex-direction: column;
  // margin-bottom: 8px;
  img {
    // width: 100%;
    border: 1px #dddddd solid;
    height: 250px;
    margin-right: 8px;
  }
}

.el-row {
  margin: 0 !important;
  display: flex;
}

.el-col-24 {
  padding: 0 !important;
  margin-bottom: 10px;
}

.sm {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%);
}
</style>
<style scoped>
.divwrap {
  height: 400px;
  overflow-y: auto;
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
}
.divwrap >>> .distpicker-address-wrapper {
  color: #999;
}
.divwrap >>> .address-header {
  position: fixed;
  bottom: 400px;
  width: 100%;
  background: #000;
  color: #fff;
}
.divwrap >>> .address-header ul li {
  flex-grow: 1;
  text-align: center;
}
.divwrap >>> .address-header .active {
  color: #fff;
  border-bottom: #666 solid 8px;
}
.divwrap >>> .address-container .active {
  color: #000;
}
</style>